observer: remove redundant manual config validators #8538
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
validateSyslog()andvalidateDebugAddr()fromobserver/obs_conf.govalidator.New()incmd/boulder-observer/main.goBackground
boulder-observer (created March 2021) has manual validation functions that predate Boulder's struct validation framework (March 2023). These manual validators are now redundant with existing struct validation tags:
The manual
validateSyslog()also had a bug: it rejectedSyslogLevel: -1, butcmd.SyslogConfigallows-1to disable syslog logging (added in #6307 for containerized environments).Test plan
go test ./observer/...passesgo build ./cmd/boulder-observer/...succeedsSyslogLevel: -1is now correctly acceptedWhen we added automatic config validation to Boulder, we also added the relevant struct tags to as many config structs as we could. This included boulder-observer's config structs, despite the fact that the config validation doesn't run on boulder-observer's configs, due to them being custom yaml rather than our standard json format.
Add a validation call to boulder-observer's main.go. Remove the handwritten config validation from obs_conf.go, and the corresponding unit tests.
Also fix a bug: validateSyslog() rejected level -1, even though we generally want to be able to set the log level to -1 to wholly disable logging.